home *** CD-ROM | disk | FTP | other *** search
-
- /*
- * A compound string shows differently in CSText and Label
- *
- * Apologies for the "segment" based nature of the XmString
- * creation - it was all I could do under Motif 1.2
- */
-
- #include <Xm/Label.h>
- #include <Xm/CSText.h>
- #include <Xm/RowColumn.h>
-
- int
- main(argc, argv)
- int argc;
- char **argv;
- {
- Widget rowcol;
- Widget button;
- XtAppContext app;
- Widget toplevel;
- Widget cstext;
- XmString str1, str2, str3;
- Arg args[10];
- int n = 0;
- XmStringCharSet charSet = XmFONTLIST_DEFAULT_TAG;
-
- toplevel = XtAppInitialize(&app, "XmSend", NULL, 0, &argc, argv,
- NULL, NULL, 0);
-
- rowcol = XmCreateRowColumn(toplevel, "rowcol", NULL, 0);
- XtManageChild(rowcol);
-
- button = XmCreateLabel(rowcol, "top_button", args, n);
- XtManageChild(button);
-
- n = 0;
- XtSetArg(args[n], XmNrows, 5); n++;
- XtSetArg(args[n], XmNeditMode, XmMULTI_LINE_EDIT); n++;
- cstext = XmCreateCSText(rowcol, "text", args, n);
- XtManageChild(cstext);
-
- str1 = XmStringSegmentCreate("hi there", charSet,
- XmSTRING_DIRECTION_L_TO_R, True);
-
- str2 = XmStringSegmentCreate("back again", charSet,
- XmSTRING_DIRECTION_R_TO_L, False);
- str3 = XmStringConcatAndFree(str1, str2);
-
- XtVaSetValues(button, XmNlabelString, str3, NULL);
- XtVaSetValues(cstext, XmNcstextValue, str3, NULL);
-
- XtRealizeWidget(toplevel);
-
- XtAppMainLoop(app);
- }
-